#include "includesT.h"
#include "ScanDataT.h"
#include "pocsT.h"
//Constructor
using namespace std;
ScanData::ScanData (int nu, Float umi, Float uma, int nv, Float vmi, Float vma, int nt, Float tmi, Float tma , Float rad, Float dist, int nx, int ny, int nz, Float z0, Float x0 )
{
	Nu = nu;
	Nv = nv;
	Nt = nt;
	Nx = nx;
	Ny = ny;
	Nz = nz;
	umin = umi;
	umax= uma;
	vmin = vmi;
	vmax = vma;
	tmin = ShiftPosition(tmi);
	tmax = ShiftPosition(tma);
	R = rad;
	D = dist;
	X2 = x0*x0;
	xmin = -x0;
	xmax = x0;
	ymin = xmin * Ny/Nx;
	ymax = xmax * Ny/Nx;
	zmax = z0;
	zmin = -z0;
	du=(umax-umin)/(Nu-1);
	dv=(vmax-vmin)/(Nv-1);
	dt=(2.0f*M_PI)/(Nt);
	dx = (xmax-xmin)/(Nx-1);
	dy = dx;
	dz = (zmax-zmin)/(Nz-1);
	rov = R*umax/sqrt(D*D + umax*umax);
	data = vector<vector<vector<Float> > >  (Nt, vector<vector<Float> > (Nu, vector<Float> (Nv))); // needs to be set after construction
	recon = vector<vector<vector<Float> > >  (Nx, vector<vector<Float> > (Ny, vector<Float> (Nz,0)));
	APdata = vector<vector<vector<Float> > >  (Nx, vector<vector<Float> > (Ny, vector<Float> (Nz,0))); // needs to be set after construction
	APmask = vector<vector<vector<bool> > >  (Nx, vector<vector<bool> > (Ny, vector<bool> (Nz,false))); // needs to be set after construction (A Priori) 1 = known
	CSmask = vector<vector<vector<bool> > >  (Nx, vector<vector<bool> > (Ny, vector<bool> (Nz,false))); // needs to be set after construction (Compact Support) 1 = within CS

	DBPmask = vector<vector<vector<bool> > > (Nx, vector<vector<bool> > (Ny, vector<bool> (Nz,false)));
	cost = vector<Float> (Nt,0);
	sint = vector<Float> (Nt,0);
	// Set cos and sin vectors
	Float t;
	int i;
	for(i=0;i<Nt;++i){
		t = IndexPosition(*this,i);
		sint[i] = sin(t);
		cost[i] = cos(t);
	}
	

	// Set zone of known DBP as true in DBPmask (use scanner FOV)
	double x,y,z;
	int j,k;
	for(i=0; i<Nx;i++){
		x = xmin + dx*i;
		for(j=0; j<Ny;j++){
			y = ymin + j*dx;
			for(k=0; k<Nz;k++){
				z = zmin + k*dz;
				//DBPmask[i][j][k] = isHilbertKnown(*this, x, y, z);
				if(x*x+y*y<=55*55 && abs(z)<=95) DBPmask[i][j][k] = true;
			}
		}
	}

	DBPdata = vector<vector<vector<Float> > > (Nx, vector<vector<Float> > (Ny,vector<Float> (Nz,0)));
	Lmask = vector<vector<bool> > (Ny,vector<bool> (Nz,false));
	Fdata = vector<vector<Float> > (Ny,vector<Float> (Nz,0));

	HT = vector<vector<Float> > (Ny,vector<Float> (Nz,0));

}


